package com.duanjw.springframework.ioc.lifecycle.dao.impl;

import com.duanjw.springframework.ioc.lifecycle.dao.UserDao;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Repository;

/**
 * 实现InitializingBean、DisposableBean接口
 *
 * @author duanjw
 */
@Repository
@Primary
public class UserDaoImpl1 implements UserDao, InitializingBean, DisposableBean {
    public UserDaoImpl1() {
        System.out.println("UserDaoImpl1空参构造初始化，hashCode：" + this.hashCode());
    }

    @Override
    public void afterPropertiesSet() {
        System.out.println("UserDaoImpl1的init方法，hashCode：" + this.hashCode());
    }

    @Override
    public void destroy() {
        System.out.println("UserDaoImpl1的destroy方法，hashCode：" + this.hashCode());
    }
}
